﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

public partial class Index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //阿城警示
            string sql = "select top 8 * from ImgNews where Category='1' ORDER BY [Top] DESC, EditDate DESC";
            int count = 0;
            DataTable dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            StringBuilder sb1,sb2;
            sb1=new StringBuilder();
            sb2=new StringBuilder();
            foreach ( DataRow dr in dt.Rows)
            {
                sb1.Append("<li><a href=\"");
                sb1.Append("ImgNews.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\"><img src=\"images/FlashPic");
                sb1.Append(dr["Img"].ToString());
                sb1.Append("\" width=\"530\" height=\"315\" /></a></li>");
                sb1.Append(System.Environment.NewLine);

                sb2.Append("<li><a href=\"");
                sb2.Append("ImgNews.aspx?id=");
                sb2.Append(dr["ID"].ToString());
                sb2.Append("\">");
                sb2.Append(dr["Title"].ToString());
                if(Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb2.Append("</a></li>");
                sb2.Append(System.Environment.NewLine);
            }            
            acjsImgLiteral.Text = sb1.ToString();
            acjsTxtLiteral.Text = sb2.ToString();

            sql = "select top 8 * from ImgNews where Category='2' ORDER BY [Top] DESC, EditDate DESC";
            sb1 = new StringBuilder();
            sb2 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<li><a href=\"");
                sb1.Append("ImgNews.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\"><img src=\"images/FlashPic");
                sb1.Append(dr["Img"].ToString());
                sb1.Append("\" width=\"206\" /></a></li>");
                sb1.Append(System.Environment.NewLine);                
            }
            tpxwLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '通知通报') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach ( DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);                
            }
            tztbLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '警营文化') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            jywhLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '每日警讯') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            mrjxLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '平安阿城') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            paacLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '公安简报') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            gajbLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '重点工作') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            zdgzLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '纪检监察') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            jjjcLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '规范执法') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            gfzfLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '户政信息') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            hzxxLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '情报专栏') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            qbzlLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '政工信息') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            zgxxLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '网上文件') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            wswjLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '领导综合信息') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            ldzhxxLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '健康小贴士') ORDER BY News.[Top] DESC, News.EditDate DESC";
            dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            sb1 = new StringBuilder();
            foreach (DataRow dr in dt.Rows)
            {
                sb1.Append("<div class=\"twitter_feed\"><a href=\"");
                sb1.Append("News.aspx?id=");
                sb1.Append(dr["ID"].ToString());
                sb1.Append("\" class=\"blue_link\">");
                sb1.Append(dr["Title"].ToString());
                if (Convert.ToBoolean(dr["Top"]))
                    sb2.Append("<img src='images/top.gif' />");
                sb1.Append("</a></div>");
                sb1.Append(System.Environment.NewLine);
            }
            jkxtsLiteral1.Text = sb1.ToString();

            sql = "SELECT top 5 News.ID, News.Title, News.[Top] FROM News INNER JOIN Category ON News.Category = Category.ID WHERE (Category.Name = '领导动态') ORDER BY News.[Top] DESC, News.EditDate DESC";
            //dt = WFNetLib.ADO.SQLServerOP.DataTableSQL(sql);
            //sb1 = new StringBuilder();
            //foreach (DataRow dr in dt.Rows)
            //{
            //     <li style="list-style: none; display: block; clear: both; "><a href="javascript:void(0)" class="blue_link">领导动态领导动态</a></li>
            //    sb1.Append("<div class=\"twitter_feed\"><a href=\"");
            //    sb1.Append("News.aspx?id=");
            //    sb1.Append(dr["ID"].ToString());
            //    sb1.Append("\" class=\"blue_link\">");
            //    sb1.Append(dr["Title"].ToString());
            //    sb1.Append("</a></div>");
            //    sb1.Append(System.Environment.NewLine);
            //}
            //lddtLiteral1.Text = sb1.ToString();
        }
    }
}